﻿@page "/"
@namespace BlazorSample.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BlazorSample</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
</head>
<body>
    <app>
        <component type="typeof(App)" render-mode="ServerPrerendered" />
    </app>

    <div id="blazor-error-ui" data-nosnippet>
        <environment include="Staging,Production">
            An error has occurred. This application may no longer respond until reloaded.
        </environment>
        <environment include="Development">
            An unhandled exception has occurred. See browser dev tools for details.
        </environment>
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>

    <script src="_framework/blazor.server.js"></script>
        <script>
        window.convertArray = (win1251Array) => {
            var win1251decoder = new TextDecoder('windows-1251');
            var bytes = new Uint8Array(win1251Array);
            var decodedArray = win1251decoder.decode(bytes);
            return decodedArray;
        };
    </script>
    <script>
        window.displayTickerAlert1 = (symbol, price) => {
            alert(`${symbol}: $${price}!`);
        };
    </script>
    <script>
        window.displayTickerAlert2 = (symbol, price) => {
            if (price < 20) {
                alert(`${symbol}: $${price}!`);
                return "Alert!";
            } else {
                return "No Alert";
            }
        };
    </script>
    <script>
        function setElementClass(element, className) {
            var myElement = element;
            myElement.classList.add(className);
        }
    </script>
    <script>
        window.returnArrayAsync = () => {
            DotNet.invokeMethodAsync('BlazorSample', 'ReturnArrayAsync')
                .then(data => {
                    console.log(data);
                });
        };
    </script>
    <script>
        window.sayHello1 = (dotNetHelper) => {
            return dotNetHelper.invokeMethodAsync('GetHelloMessage');
        };
    </script>
    <script>
        window.sayHello2 = (dotNetHelper, name) => {
            return dotNetHelper.invokeMethodAsync('GetHelloMessage', name);
        };
    </script>
    <script>
        window.updateMessageCaller3 = (dotnetHelper) => {
            dotnetHelper.invokeMethodAsync('UpdateMessageCaller3');
            dotnetHelper.dispose();
        }
    </script>
    <script>
        window.scrollElementIntoView = (element) => {
          element.scrollIntoView();
          return element.getBoundingClientRect().top;
        }
    </script>
</body>
</html>
